<?php

namespace App\Observers;

use App\Jobs\NoticeJob;
use App\Models\Notice;
use Illuminate\Support\Facades\Log;

class NoticeObserver
{
    /**
     * 添加完成后执行此方法
     * @param Notice $notice
     */
    public function created(Notice $notice)
    {
        // Log::info('==================hahahaha===============');
        // 发布任务
        dispatch(new NoticeJob());
    }

    /**
     * 修改完成后执行此方法
     * @param Notice $notice
     */
    public function updated(Notice $notice)
    {
        //
    }

    /**
     * Handle the notice "deleted" event.
     *
     * @param \App\Models\Notice $notice
     * @return void
     */
    public function deleted(Notice $notice)
    {
        //
    }

    /**
     * Handle the notice "restored" event.
     *
     * @param \App\Models\Notice $notice
     * @return void
     */
    public function restored(Notice $notice)
    {
        //
    }

    /**
     * Handle the notice "force deleted" event.
     *
     * @param \App\Models\Notice $notice
     * @return void
     */
    public function forceDeleted(Notice $notice)
    {
        //
    }
}
